package mail.fetch.aliyun;

import mail.entity.ProxyEntity;
import mail.util.FileManager;

import java.net.CookieManager;
import java.net.CookieStore;
import java.net.HttpCookie;
import java.nio.charset.Charset;
import java.util.List;

import static com.han.http.util.Print.printlnInfo;

/**
 * @author: Hanjiafeng
 * @date: Created in 11:48 2019/3/12
 * @desc:
 */
public class AliyunEntrance {

    public static void main(String... args) throws Exception {
        AliyunEntrance aliyunEntrance = new AliyunEntrance();
        aliyunEntrance.t1();
    }

    private void t1() throws Exception {

        ProxyEntity proxyEntity = new ProxyEntity("", "localhost", 8888, "", "");

        Login11 login11 = new Login11(proxyEntity);
        CookieManager cookieManager = login11.getCookieManager("limindeyou", "AdaidaiA1");

        Inbox11 inbox11 = new Inbox11(cookieManager, proxyEntity);
        List<AliyunMailEntity> aliyunMailEntityList = inbox11.getMailListDuringHalfYear();
        for (AliyunMailEntity entity : aliyunMailEntityList) {
            FileManager.overwrite("F:\\AliyunCreditBill\\" + System.currentTimeMillis() + ".html", entity.getContent()
                    , Charset.forName("gb2312"));
        }
    }
}
